package b3.widget.guide
{
	import b3.util.*;
	import b3.widget.basic.*;
	
	import flash.display.*;
	import flash.events.*;

	public class ClickableHole extends Sprite
	{
		public var anchor:int;
		private var ellipseX:Number;
		private var ellipseY:Number;
		private var ellipseW:Number;
		private var ellipseH:Number;
		
		public function ClickableHole(x:Number, y:Number, width:Number, height:Number, anchor:int = BasicWidget.ANCHOR_LEFT_TOP):void
		{
			super();
			this.anchor = anchor;
			this.ellipseX = x;
			this.ellipseY = y;
			this.ellipseW = width;
			this.ellipseH = height;
			this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
			this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
		}
		
		private function onAddedToStage(event:Event):void
		{
			stage.addEventListener(Event.FULLSCREEN, onFullScreen);
			onFullScreen(null);
		}

		private function onRemovedFromStage(event:Event):void
		{
			stage.removeEventListener(Event.FULLSCREEN, onFullScreen);
		}
		
		private function onFullScreen(event:Event):void
		{
			var anchorX:Number = (BFont.stageWidth / 2) * (anchor % 3);
			var anchorY:Number = (BFont.stageHeight / 2) * int(anchor / 3);
			graphics.clear();
			graphics.beginFill(0xFFFFFF, 0.25);
			graphics.drawRect(0, 0, BFont.stageWidth, BFont.stageHeight);
			graphics.drawEllipse(anchorX + ellipseX, anchorY + ellipseY, ellipseW, ellipseH);
			graphics.endFill();
		}
	}
}